<template>
    <el-dialog :title="title" :visible.sync="visible" width="1100px" append-to-body>
      <el-row>
        <el-form
          :model="queryParams"
          label-width="90px"
          ref="queryForm"
          :inline="true"
        >
          <el-form-item label="姓名">
            <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable />
          </el-form-item>
          <el-form-item label="学生学号">
            <el-input
              v-model="queryParams.sno"
              placeholder="请输入学号"
              clearable
            />
          </el-form-item>
        
          <el-col :span="18">
            <el-form-item></el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item>
              <div style="float:right;">
                <el-button type="primary" icon="el-icon-search" @click="search" size="mini">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
              </div>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <el-table
        :data="tableData"
        style="width: 100%"
        v-loading="loading"
      >
        <el-table-column prop="name" label="姓名"  align="center"></el-table-column>
        <el-table-column
          prop="sno"
          label="学号"
          :show-overflow-tooltip="true"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="deptNames"
          :show-overflow-tooltip="true"
          label="所在院部"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="specialityName"
          :show-overflow-tooltip="true"
          label="专业"
          align="center"
        ></el-table-column>
        <el-table-column prop="gradeName" label="年级" align="center"  :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="className" label="班级" align="center"  :show-overflow-tooltip="true"></el-table-column>
        <el-table-column
          prop="political"
          label="政治面貌"
          align="center"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <dict-tag :options="dict.type.bc_political_type" :value="scope.row.political"></dict-tag>
          </template>
        </el-table-column>
        <el-table-column prop="bnpName" label="籍贯" align="center"  :show-overflow-tooltip="true">

        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="100px"
        >
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="addPeople(scope.row)">添加为组织成员</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-dialog>
  </template>
  <script>
  import {
    studentList,
  } from "@/api/information/studentInfor";
  export default {
    props: {

    },
    components: {},
    dicts: [
        "bc_political_type", // 政治面貌
    ],
    data() {
      return {
        queryParams:{
            name: '',
            sno: '',
        },
        visible: false,
        title: '',
        total: 0,
        tableData: []
      }
    },
    created() {
      this.getList();
    },
  
    methods: {
      open () {
        this.visible = true
        this.title = '新增组织人员'
      },
      /** 查询用户列表 */
      getList() {
        studentList(this.queryParams).then(response => {
          this.tableData = response.rows;
          this.total = response.total;
        }).finally(()=>{
          this.loading = false;
        })
      },
      // 查询
      search() {
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.queryParams = {};
        this.queryParams.pageNum = 1;
        this.queryParams.pageSize = 10;
        this.search();
      },
      addPeople (rowdata) {
        this.$emit("addUser", rowdata)
      }
    },
    mounthed() {}
  };
  </script>
  
  <style scoped>
  .checks {
    width: 22%;
  }
  .formItem {
    margin-top: 12px;
    margin-bottom: 12px;
  }
  .elSelect {
    width: 100%;
  }
  </style>